跳到主要内容

AddHyperlink

Adds a hyperlink to a paragraph.

Syntax

expression.AddHyperlink(sLink, sScreenTipText);

expression - A variable that represents a ApiParagraph class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sLinkRequiredstringThe link address.
sScreenTipTextRequiredstringThe screen tip text.

Returns

ApiHyperlink | null

Example

This example adds a hyperlink to a paragraph.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("ONLYOFFICE Document Builder");
paragraph.AddElement(run);
paragraph.AddHyperlink("https://api.onlyoffice.com/docbuilder/basic", "docbuilder");